package com.hui10.mediaplayer.sigleton

/**
 * Author: Created by lucus on 2019/5/24.
 * E-mail: mcphilex1989@gmail.com
 * Tel: 15652608401
 * 线程安全kotlin 懒汉式 单例
 */
class SafeLazySingle private constructor() {

    companion object {
        private var instance: SafeLazySingle? = null
            get() {
                if (field == null) {
                    field = SafeLazySingle()
                }
                return field
            }

        @Synchronized
        fun get(): SafeLazySingle {
            return instance!!
        }
    }

    fun printName(){
        println(javaClass.simpleName)
    }

}